<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>思云课堂</title>
    <link rel="stylesheet" href="/layui/css/layui.css">
    <link rel="stylesheet" href="/css/navigationBar/navigationBar.css">
    <script src="/jquery/jquery-3.2.1.min.js"></script>
    <script src="/lib/vue-2.6.12.js"></script>
    <!--<script src="https://unpkg.com/axios/dist/axios.min.js"></script>-->
    <script src="/layui/layui.js"></script>
</head>
<style>

</style>
<body>
<div class="layui-layout layui-layout-admin " id="app" lay-filter="nav-tree">
    <div class="layui-header">
        <div style="width: 250px" class="layui-logo layui-hide-xs header-font"><a href="javascript:;"><h3 style="color: #fff">思云课堂后台业务管理系统</h3></a></div>
        <ul class="layui-nav layui-layout-right" lay-filter="" @mouseout="hideAll">
            <li class="layui-nav-item" @mouseover="showUser" style="position:relative;margin-left: 20px;margin-right: 20px;" title="个人信息">
                <img id="headerImage" src=""  class="layui-circle" style="border: 2px solid #A9B7B7;width: 45px;height: 45px;" alt="" />
                <span class="userName" id="userName"></span>
                <div @mouseout="hideUser" id="user-div" style="box-shadow:rgba(0, 0, 0, 0.35) 0px 0px 3px;display:none;position: fixed;top:60px;right: 75px;width:420px;height: 235px;background-color: white">
                    <div class="account">
                        <span>账户信息</span>
                        <a onclick="jumpAccount()" id="accountSettings" style="color: #0eac9f;" href="javascript:;">账户设置</a>
                        <a id="accountHref" href="" style="display: none;"></a>
                    </div>
                    <div class="message">
                        <div>所在部门：<span id="loginDept"></span></div>
                        <div>本次登录：<span id="nowLoginTime"></span></div>
                        <div>登录地区：<span id="loginAddress"></span><span>(IP：</span><span id="loginIp"></span><span>)</span></div>
                        <div>上次登录：<span id="oldLoginTime"></span></div>
                    </div>
                </div>
            </li>
            <li onclick="jumpSystemHome()" id="systemHomeHit" class="layui-nav-item" style="margin-left: 20px;margin-right: 20px;" title="首页">
                <a id="systemHome" href="" style="display: none;"></a>
                <span class="layui-icon layui-icon-home"></span>
            </li>
            <li class="layui-nav-item" @mouseover="showMore" style="margin-left: 20px;margin-right: 20px;" title="常用菜单">
                <span class="layui-icon layui-icon-spread-left"></span>
                <div @mouseout="hideMore" id="more-div" style="box-shadow:rgba(0, 0, 0, 0.35) 0px 0px 3px;display:none;position: fixed;top:60px;right: 27px;width:420px;height: 235px;background-color: white">
                    <div class="account">
                        <span style="color: #A6A6A6;">常用菜单</span>
                        <a style="color: #0eac9f;" href="javascript:;">菜单管理</a>
                    </div>
                    <div class="menu">
                        <div>
                            <a id="commodityList" onclick="jumpCommodityList()" style="display:inline;color: #333;" href="javascript:;">商品列表</a>
                            <a id="commodityListHref" href="" style="display: none;"></a>
                            <a id="userList" onclick="jumpUserList()" style="display:inline;color: #333;" href="javascript:;">用户列表</a>
                            <a id="userListHref" href="" style="display: none;"></a>
                            <a id="lunImgsList" onclick="jumpLunImgsList()" style="display:inline;color: #333;" href="javascript:;">轮播图列表</a>
                            <a id="lunImgsListHref" href="" style="display: none;"></a>
                        </div>
                        <div>
                            <a id="classList" onclick="jumpClassList()" style="display:inline;color: #333;" href="javascript:;">课程列表</a>
                            <a id="classListHref" href="" style="display: none;"></a>
                            <a id="behindUserList" onclick="jumpBehindUserList()" style="display:inline;color: #333;" href="javascript:;">后台人员列表</a>
                            <a id="behindUserListHref" href="" style="display: none;"></a>
                            <a id="transactionImgsList" onclick="jumpTransactionImgsList()" style="display:inline;color: #333;margin-left:-28px;" href="javascript:;">订单统计</a>
                            <a id="transactionImgsListHref" href="" style="display: none;"></a>
                        </div>
                        <div>
                            <a id="microCircleList" onclick="jumpMicroCircleList()" style="display:inline;color: #333;" href="javascript:;">微圈列表</a>
                            <a id="microCircleListHref" href="" style="display: none;"></a>
                            <a id="departmentList" onclick="jumpDepartmentList()" style="display:inline;color: #333;" href="javascript:;">部门管理</a>
                            <a id="departmentListHref" href="" style="display: none;"></a>
                            <a id="couponList" onclick="jumpCouponList()" style="display:inline;color: #333;" href="javascript:;">优惠券列表</a>
                            <a id="couponListHref" href="" style="display: none;"></a>
                        </div>
                    </div>
                </div>
            </li>
            <li class="layui-nav-item" @mouseover="showNotice" style="margin-left: 20px;margin-right: 20px;" title="系统消息">
                <span class="layui-icon layui-icon-notice"></span>
                <span class="layui-badge" style="margin-left: 5px">0</span>
                <div @mouseout="hideNotice" id="notice-div" style="box-shadow:rgba(0, 0, 0, 0.35) 0px 0px 3px;display:none;position: fixed;top:60px;right: 75px;width:420px;background-color: white">
                    <div class="topAlert">
                        <div>
                            <span>审核提示</span>
                        </div>
                        <div>
                            <a style='display:inline;color: #333;'href='javascript:;' onclick='jumpCurriculumToExamineHref()'><div style='float: left;'>课程待审核</div><div class='count_right' style='float: right;margin-right: 20px;'><span class='count_left'>(</span><span id="span1" class='fColor' style='color: red;'></span><span class='count_left'>)</span></div></a>
                        </div>
                        <div>
                            <a style='display:inline;color: #333;'href='javascript:;' onclick='jumpCommodityToExamineHref()'><div style='float: left;'>商品待审核</div><div class='count_right' style='float: right;margin-right: 20px;'><span class='count_left'>(</span><span id="span2" class='fColor' style='color: red;'></span><span class='count_left'>)</span></div></a>
                        </div>
                        <div>
                            <a style='display:inline;color: #333;'href='javascript:;' onclick='jumpMicroCircleToExamineHref()'><div style='float: left;'>微圈待审核</div><div class='count_right' style='float: right;margin-right: 20px;'><span class='count_left'>(</span><span id="span3" class='fColor' style='color: red;'>"</span><span class='count_left'>)</span></div></a>
                        </div>
                    </div>
                    <div class="headAlert">
                        <div>
                            <span>订单提示</span>
                        </div>
                        <div>
                            <a style='display:inline;color: #333;'href='javascript:;' onclick='jumpCommodityOrderList()'><div style='float: left;'>待付款订单</div><div class='count_right' style='float: right;margin-right: 20px;'><span class='count_left'>(</span><span id="span4" class='fColor' style='color: red;'></span><span class='count_left'>)</span></div></a>
                        </div>
                        <div>
                            <a style='display:inline;color: #333;'href='javascript:;' onclick='jumpCommodityOrderList()'><div style='float: left;'>待发货订单</div><div class='count_right' style='float: right;margin-right: 20px;'><span class='count_left'>(</span><span id="span5" class='fColor' style='color: red;'></span><span class='count_left'>)</span></div></a>
                        </div>
                        <div>
                            <a style='display:inline;color: #333;'href='javascript:;' onclick='jumpUnsubscribeListHref()'><div style='float: left;'>申请退订订单</div><div class='count_right' style='float: right;margin-right: 20px;'><span class='count_left'>(</span><span id="span6" class='fColor' style='color: red;'></span><span class='count_left'>)</span></div></a>
                        </div>
                    </div>
                    <div class="footAlert">
                        <div>
                            <span>广告位提示</span>
                        </div>
                        <div>
                            <a style='display:inline;color: #333;'href='javascript:;' onclick='jumpLunImgsList()'><div style='float: left;'>即将到期广告位</div><div class='count_right' style='float: right;margin-right: 20px;'><span class='count_left'>(</span><span id="span7" class='fColor' style='color: red;'></span><span class='count_left'>)</span></div></a>
                        </div>
                    </div>
                    <!--订单列表-->
                    <a id="commodityOrderListHref" href="" style="display: none;"></a>
                    <!--申请退订列表-->
                    <a id="unsubscribeListHref" href="" style="display: none;"></a>
                    <!--课程审核列表-->
                    <a id="curriculumToExamineHref" href="" style="display: none;"></a>
                    <!--商品审核列表-->
                    <a id="commodityToExamineHref" href="" style="display: none;"></a>
                    <!--微圈审核列表-->
                    <a id="microCircleToExamineHref" href="" style="display: none;"></a>
                    <!--微圈评论-->
                    <a id="microCircleCommentHref" href="" style="display: none;"></a>
                    <!--课程评论-->
                    <a id="curriculumCommentHref" href="" style="display: none;"></a>
                    <!--审核日志-->
                    <a id="toExamineLogHref" href="" style="display: none;"></a>
                </div>
            </li>
            <li class="layui-nav-item" style="margin-left: 20px;margin-right: 20px;" title="退出登录">
                <span onclick="loginOut()" id="loginOut" class="layui-icon layui-icon-logout"></span>
            </li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">

        </div>
    </div>
    <div class="layui-body">
        <div class="layui-tab layui-tab-card" lay-filter="tab" lay-allowclose="true" style="height: 100%">
            <ul id="hitLi" class="layui-tab-title">
                <li class="layui-this" lay-id="0">首页</li>
            </ul>
            <ul class="rightmenu" style="display: none;position:absolute;background-color: #fff;width: 70px;height: 90px;">
                <li data-type="closeNow"><span href="javascript:;">关闭当前</span></li>
                <li data-type="closeOthers"><span href="javascript:;">关闭其他</span></li>
                <li data-type="closeAll"><span href="javascript:;">关闭所有</span></li>
            </ul>
            <div class="layui-tab-content" style="height: 100%;">
                <div class="layui-tab-item layui-show">
                    <iframe id="iframe0" frameborder="0" src="/operateIndex.html"  class="iframe"></iframe>
                </div>
            </div>
        </div>
    </div>
</div>
    <input type="hidden" name="user" th:value="${session.user}"/>
    <div id="quickEntry" onclick="quickEntry()" style="display: none;"></div>
<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
<!--<script src="/js/navigationBar/navigationBar.js"></script>-->
<script>
    var str = '';
    var index;
    var numArr = [0];
    localStorage.setItem("numArr",numArr);
    var userId;
    var element, layer, util, $;
    layui.use(['element', 'layer', 'util','jquery'], function(){
        element = layui.element,
            layer = layui.layer,
            util = layui.util,
            $ = layui.jquery;
        us($('input[name = user]').val());
        function us(data) {
            var a = data;
            var c = a.substring(a.indexOf('(')+1,a.indexOf(')')).split(', ');
            var d = {};
            for (var i = 0; i < c.length; i++) {
                var n = c[i].split('=');
                d[n[0]] = n[1];
            }
            localStorage.setItem("user",JSON.stringify(d));
        };

        //获取登录人员id
        var user = JSON.parse(localStorage.getItem("user"));
        userId = user.userId;

        //获取登录头像和部门
        getJsUser(userId);
        //获取登录日志信息
        getLoginUser(userId);
        //获取导航栏数据
        getNavigationBarData(10);
    });

    function getNavigationBarData(type) {
        $.ajax({
            url:'/navigationBarData/getNavigationBarData',
            method:'post',
            data:{"type": type},
            dataType:'json',
            async: false,
            success:function (data) {
                console.log(data);
                var vm = new Vue({
                    el:'#app',
                    data: {},
                    methods:{
                        //头部导航栏隐藏框的展示与隐藏
                        showUser(){
                            $('#user-div').css('display','inline-block');
                        },
                        hideUser(){
                            $('#user-div').css('display','none');
                        },
                        showMore(){
                            $('#more-div').css('display','inline-block');
                        },
                        hideMore(){
                            $('#more-div').css('display','none');
                        },
                        showNotice(){
                            $('#notice-div').css('display','inline-block');
                        },
                        hideNotice(){
                            $('#notice-div').css('display','none');
                        },
                        hideAll(){
                            $('#user-div').css('display','none');
                            $('#more-div').css('display','none');
                            $('#notice-div').css('display','none');
                        }
                    },
                    created(){}
                });

                var nav = data.data;
                var html = '';
                html +='<ul class="layui-nav layui-nav-tree"  lay-filter="nav-tree">';
                $.each(nav,function (i,item) {
                    html = html+'<li class="layui-nav-item">';
                    html += '<a href="javascript:;">'+item.icon+item.menuName+'</a>';
                    if(item.children.length > 0){
                        html += '<dl class="layui-nav-child">';
                        $.each(item.children,function (j,children) {
                            html+='<dd>'
                            html += '<a href="javascript:;">'+children.menuName+'</a>';
                            if(children.children.length > 0){
                                html += '<dl class="layui-nav-child">';
                                $.each(children.children,function (k,childrenItem) {
                                    html += '<dd>'+
                                        '<a href="javascript:;" onclick="hitEvent(this)" class="submenu" _href="'+childrenItem.url+'">'+childrenItem.menuName+'</a>' +
                                        '<a class="a2" style="display: none" class="submenu2" href="'+childrenItem.url+'">'+childrenItem.menuName+'</a>'+
                                        '</dd>';
                                });
                                html+= '</dl>';
                            }
                        });
                        html+= '</dl>' ;
                    };
                    html+= '</li>';
                });
                html+='</ul>';
                $(".layui-side-scroll").append(html);

                //更新渲染导航栏
                element.init();
                changeFontColor();

                //点击导航栏关闭其他导航栏
                $(".layui-nav-tree li").on("click","a",function (e) {
                    if($(this).parent("li").hasClass("closeDao")){
                        $(this).parent("li").removeClass("layui-nav-itemed");
                        $(this).parent("li").removeClass("closeDao");
                    }else{
                        $(this).parent("li").addClass("layui-nav-itemed").siblings("li").removeClass("layui-nav-itemed");
                        $(this).parent("li").addClass("closeDao").siblings("li").removeClass("closeDao");
                    }
                    $(this).siblings("dl").children("dd").removeClass("closeDao").siblings("dd").removeClass("closeDao");
                    $(this).siblings("dl").children("dd").removeClass("layui-nav-itemed").siblings("dd").removeClass("layui-nav-itemed");
                });

                //点击导航栏关闭其他导航栏(内部)
                $(".layui-nav-tree li dl dd").on("click","a",function (e) {
                    if($(this).parent("dd").hasClass("closeDao")){
                        $(this).parent("dd").removeClass("layui-nav-itemed");
                        $(this).parent("dd").removeClass("closeDao");
                    }else{
                        $(this).parent("dd").addClass("layui-nav-itemed").siblings("dd").removeClass("layui-nav-itemed");
                        $(this).parent("dd").addClass("closeDao").siblings("dd").removeClass("closeDao");
                    }
                });



                $("#hitLi").on("click","li",function () {
                    var i = $(this).attr("lay-id");
                    var arr = localStorage.getItem("numArr");
                    i = "" + i + "";
                    numArr = arr.split(",");
                    if (i != numArr[numArr.length -1]){
                        numArr.push(i);
                    }
                    localStorage.setItem("numArr",numArr);
                });

                var accountHref;
                var h;
                var systemHomeHref;
                var systemHomeTitle;

                $("dd .a2").each(function () {
                    if ($(this).text() == "账户设置"){
                        accountHref = $(this).attr("href");
                        h = $(this).text();
                        return;
                    }
                    if ($(this).text() == "首页"){
                        systemHomeHref = $(this).attr("href");
                        systemHomeTitle = $(this).text();
                        return;
                    }
                    if ($(this).text() == "微圈列表"){
                        microCircleListHref = $(this).attr("href");
                        microCircleListTitle = $(this).text();
                        return;
                    }
                    if ($(this).text() == "商品列表"){
                        commodityListHref = $(this).attr("href");
                        commodityListTitle = $(this).text();
                        return;
                    }
                    if ($(this).text() == "用户列表"){
                        userListHref = $(this).attr("href");
                        userListTitle = $(this).text();
                        return;
                    }
                    if ($(this).text() == "轮播图列表"){
                        lunImgsListHref = $(this).attr("href");
                        lunImgsListTitle = $(this).text();
                        return;
                    }
                    if ($(this).text() == "课程列表"){
                        classListHref = $(this).attr("href");
                        classListTitle = $(this).text();
                        return;
                    }
                    if ($(this).text() == "后台人员列表"){
                        behindUserListHref = $(this).attr("href");
                        behindUserListTitle = $(this).text();
                        return;
                    }
                    if ($(this).text() == "订单统计"){
                        transactionImgsListHref = $(this).attr("href");
                        transactionImgsListTitle = $(this).text();
                        return;
                    }
                    if ($(this).text() == "部门管理"){
                        departmentListHref = $(this).attr("href");
                        departmentListTitle = $(this).text();
                        return;
                    }
                    if ($(this).text() == "优惠券列表"){
                        couponListHref = $(this).attr("href");
                        couponListTitle = $(this).text();
                        return;
                    }
                    if ($(this).text() == "商品订单列表"){
                        commodityOrderListHref = $(this).attr("href");
                        return;
                    }
                    if ($(this).text() == "申请退订列表"){
                        unsubscribeListHref = $(this).attr("href");
                        return;
                    }
                    if ($(this).text() == "课程审核列表"){
                        curriculumToExamineHref = $(this).attr("href");
                        return;
                    }
                    if ($(this).text() == "商品审核列表"){
                        commodityToExamineHref = $(this).attr("href");
                        return;
                    }
                    if ($(this).text() == "微圈审核列表"){
                        microCircleToExamineHref = $(this).attr("href");
                        return;
                    }
                    if ($(this).text() == "微圈评论"){
                        microCircleCommentHref = $(this).attr("href");
                        return;
                    }
                    if ($(this).text() == "课程评论"){
                        curriculumCommentHref = $(this).attr("href");
                        return;
                    }
                    if ($(this).text() == "审核日志"){
                        toExamineLogHref = $(this).attr("href");
                        return;
                    }
                });

                $("#accountHref").attr("href",accountHref);
                $("#systemHome").attr("href",systemHomeHref);
                $("#microCircleListHref").attr("href",microCircleListHref);
                $("#commodityListHref").attr("href",commodityListHref);
                $("#userListHref").attr("href",userListHref);
                $("#lunImgsListHref").attr("href",lunImgsListHref);
                $("#classListHref").attr("href",classListHref);
                $("#behindUserListHref").attr("href",behindUserListHref);
                $("#transactionImgsListHref").attr("href",transactionImgsListHref);
                $("#departmentListHref").attr("href",departmentListHref);
                $("#couponListHref").attr("href",couponListHref);
                $("#commodityOrderListHref").attr("href",commodityOrderListHref);
                $("#unsubscribeListHref").attr("href",unsubscribeListHref);
                $("#curriculumToExamineHref").attr("href",curriculumToExamineHref);
                $("#commodityToExamineHref").attr("href",commodityToExamineHref);
                $("#microCircleToExamineHref").attr("href",microCircleToExamineHref);
                $("#microCircleCommentHref").attr("href",microCircleCommentHref);
                $("#curriculumCommentHref").attr("href",curriculumCommentHref);
                $("#toExamineLogHref").attr("href",toExamineLogHref);


                //hitKuaiJie();
                //loadDao();
                //获取选项卡删除事件
                $(".layui-tab").on("click",function(e){
                    if($(e.target).is(".layui-tab-close")){
                        $(".rightmenu").css("display","none");
                    }
                });

                //解决删除中间选项卡不能返回的bug
                $(".layui-tab").on("mouseover",function(e){
                    if($(e.target).is(".layui-tab-close")){
                        var indexNum = $(e.target).parent("li").attr("lay-id");
                        var jq = $(e.target);
                        indexNum = "" + indexNum + "";

                        var arr = localStorage.getItem("numArr");
                        numArr = arr.split(",");

                        jq.on("click",function () {
                            //将满足指定条件的数组元素存放到新数组并返回新数组
                            var newNumArr = numArr.filter(function (item) {
                                if (item != indexNum ){
                                    return item;
                                }
                            });
                            var newArr = [];
                            //
                            for (var i = 0; i < newNumArr.length; i++) {
                                if (newNumArr[i] != newNumArr[i + 1]) {
                                    newArr.push(newNumArr[i]);
                                }
                            }
                            numArr = newArr;

                            localStorage.setItem("numArr",numArr);
                            return true;
                        });
                    }
                });
                rightClick();
                loading();

                //获取各订单不同状态的订单数量
                getOrderQuantityStatus(userId);
            }
        })
    };

    function getJsUser(id) {
        $.ajax({
            url:'/navigationBarData/getJsUser',
            method:'post',
            data:{"id": id},
            dataType:'json',
            success: function (data) {
                $("#headerImage").attr("src",data.data.acatarUrl);
                $("#loginDept").text(data.data.deptName);
                $("#userName").text(data.data.trueName);
            }
        })
    };

    function getLoginUser(id) {
        $.ajax({
            url:'/navigationBarData/getLoginUser',
            method:'post',
            data:{"id": id},
            dataType:'json',
            success: function (data) {
                if (data.data[0] != null){
                    $("#nowLoginTime").text(data.data[0].loginDate);
                    if (data.data[1] != null){
                        $("#oldLoginTime").text(data.data[1].loginDate);
                    }
                    $("#loginAddress").text(data.data[0].loginAddress);
                    $("#loginIp").text(data.data[0].loginIp);
                }
            }
        })
    };

    function getOrderQuantityStatus(id) {
        var orderNum = 0;
        //订单提示
        $.ajax({
            url: "/navigationBarData/getOrderQuantityStatus",
            methods: "post",
            data: {"id": id},
            dataType: "json",
            success: function (data) {
                /*$(".topAlert").append("<div> <a style='display:inline;color: #333;'href='javascript:;' onclick='jumpCurriculumToExamineHref()'><div style='float: left;'>课程待审核</div><div class='count_right' style='float: right;margin-right: 20px;'><span class='count_left'>(</span><span class='fColor' style='color: red;'>"+ data.data.videoNoNums +"</span><span class='count_left'>)</span></div></a> </div>");
                */
                $("#span1").text(data.data.videoNoNums);
                orderNum += data.data.videoNoNums;

                /*$(".topAlert").append("<div> <a style='display:inline;color: #333;'href='javascript:;' onclick='jumpCommodityToExamineHref()'><div style='float: left;'>商品待审核</div><div class='count_right' style='float: right;margin-right: 20px;'><span class='count_left'>(</span><span class='fColor' style='color: red;'>"+ data.data.commodityNoNums +"</span><span class='count_left'>)</span></div></a> </div>");
                */
                $("#span2").text(data.data.commodityNoNums);
                orderNum += data.data.commodityNoNums;


                /*$(".topAlert").append("<div> <a style='display:inline;color: #333;'href='javascript:;' onclick='jumpMicroCircleToExamineHref()'><div style='float: left;'>微圈待审核</div><div class='count_right' style='float: right;margin-right: 20px;'><span class='count_left'>(</span><span class='fColor' style='color: red;'>"+ data.data.microCircleNoNums +"</span><span class='count_left'>)</span></div></a> </div>");
                */
                $("#span3").text(data.data.microCircleNoNums);
                orderNum += data.data.microCircleNoNums;

                /*$(".headAlert").append("<div> <a style='display:inline;color: #333;'href='javascript:;' onclick='jumpCommodityOrderList()'><div style='float: left;'>待付款订单</div><div class='count_right' style='float: right;margin-right: 20px;'><span class='count_left'>(</span><span class='fColor' style='color: red;'>"+ data.data.noPayment +"</span><span class='count_left'>)</span></div></a> </div>");
                */
                $("#span4").text(data.data.noPayment);
                orderNum += data.data.noPayment;

                /*$(".headAlert").append("<div> <a style='display:inline;color: #333;'href='javascript:;' onclick='jumpCommodityOrderList()'><div style='float: left;'>待发货订单</div><div class='count_right' style='float: right;margin-right: 20px;'><span class='count_left'>(</span><span class='fColor' style='color: red;'>"+ data.data.noSendGoods +"</span><span class='count_left'>)</span></div></a> </div>");
                */
                $("#span5").text(data.data.noSendGoods);
                orderNum += data.data.noSendGoods;

                /*$(".headAlert").append("<div> <a style='display:inline;color: #333;'href='javascript:;' onclick='jumpUnsubscribeListHref()'><div style='float: left;'>申请退订订单</div><div class='count_right' style='float: right;margin-right: 20px;'><span class='count_left'>(</span><span class='fColor' style='color: red;'>"+ data.data.returnRequest +"</span><span class='count_left'>)</span></div></a> </div>");
                */
                $("#span6").text(data.data.returnRequest);
                orderNum += data.data.returnRequest;

                //广告位提示
                $.ajax({
                    url:'/Advertisement/getAdvertisement',
                    methods: "post",
                    dataType:'json',
                    data: {"display": '', "imgType": ''},
                    success:function (data) {
                        var nowDate = new Date().getTime();
                        var n = 0;
                        for (var i = 0; i < data.data.length ; i++) {
                            //将日期转换为毫秒值
                            var expireDate = new Date( data.data[i].expireDate.replace(new RegExp("-","gm"),"/")).getTime();
                            if ((expireDate - nowDate) <= 172800000 && (expireDate - nowDate) > 0) {
                                n += 1;
                            }else {
                                break;
                            }
                        }
                        /*$(".footAlert").append("<div> <a style='display:inline;color: #333;'href='javascript:;' onclick='jumpLunImgsList()'><div style='float: left;'>即将到期广告位</div><div class='count_right' style='float: right;margin-right: 20px;'><span class='count_left'>(</span><span class='fColor' style='color: red;'>"+ n +"</span><span class='count_left'>)</span></div></a> </div>");
                        */
                        $("#span7").text(n);
                        orderNum += n;
                        $(".layui-badge").text(orderNum);
                        changeFontColor();
                    }
                });
                hitKuaiJie();
            }
        });
    };

    //头部导航栏菜单消息鼠标悬停改变颜色
    function changeFontColor() {
        $(".menu a,#notice-div a").on("mouseover",function () {
            $(this).css("color","#0DAB9E");
            $(this).find(".count_left").css("color","#0DAB9E");
            $(this).find(".fColor").css("color","#0DAB9E");
        });
        $(".menu a,#notice-div a").on("mouseout",function () {
            $(this).css("color","#000");
            $(this).find(".count_left").css("color","#000");
            $(this).find(".fColor").css("color","red");
        });
    }

    //侧边导航栏点击跳转并添加选项卡
    function hitEvent(obj){
        var href = $(obj).attr('_href');
        var title = $(obj).text();
        var len = 0;
        if ($('.layui-tab-title li').length != 0){
            len = parseInt($(".layui-tab-title li").eq($('.layui-tab-title li').length-1).attr("lay-id")) + 1;
        } else{
            len = 0;
        }
        publicCode(title,href,len);
    }

    //头部导航栏点击跳转商品订单列表
    function jumpCommodityOrderList() {
        var title = "商品订单列表";
        var href = $("#commodityOrderListHref").attr("href");
        var len =  $('.layui-tab-title li').length;
        publicCode(title,href,len);
    }

    //头部导航栏点击跳转申请退订列表
    function jumpUnsubscribeListHref() {
        var title = "申请退订列表";
        var href = $("#unsubscribeListHref").attr("href");
        var len =  $('.layui-tab-title li').length;
        publicCode(title,href,len);
    }

    //头部导航栏点击跳转课程审核列表
    function jumpCurriculumToExamineHref() {
        var title = "课程审核列表";
        var href = $("#curriculumToExamineHref").attr("href");
        var len =  $('.layui-tab-title li').length;
        publicCode(title,href,len);
    }

    //头部导航栏点击跳转商品审核列表
    function jumpCommodityToExamineHref() {
        var title = "商品审核列表";
        var href = $("#commodityToExamineHref").attr("href");
        var len =  $('.layui-tab-title li').length;
        publicCode(title,href,len);
    }


    //头部导航栏点击跳转微圈审核列表
    function jumpMicroCircleToExamineHref() {
        var title = "微圈审核列表";
        var href = $("#microCircleToExamineHref").attr("href");
        var len =  $('.layui-tab-title li').length;
        publicCode(title,href,len);
    }


    //头部导航栏点击跳转账户设置
    function jumpAccount() {
        var title = $("#accountSettings").text();
        var href = $("#accountHref").attr("href");
        var len =  $('.layui-tab-title li').length;
        publicCode(title,href,len);
    }

    //头部常用菜单跳转商品列表
    function jumpCommodityList() {
        var title = $("#commodityList").text();
        var href = $("#commodityListHref").attr("href");
        var len =  $('.layui-tab-title li').length;
        publicCode(title,href,len);
    }

    //头部常用菜单跳转微圈列表
    function jumpMicroCircleList() {
        var title = $("#microCircleList").text();
        var href = $("#microCircleListHref").attr("href");
        var len =  $('.layui-tab-title li').length;
        publicCode(title,href,len);
    }

    //首页快捷入口
    function hitKuaiJie() {
        $("#iframe0").contents().find("#operate").on("click",function (e) {
            if($(e.target).parents("#microCircleList").is("#microCircleList")){
                var title = $("#microCircleList").text();
                var href = $("#microCircleListHref").attr("href");
                var len =  $('.layui-tab-title li').length;
                publicCode(title,href,len);
            }
            if($(e.target).parents("#accountSettings").is("#accountSettings")){
                var title = $("#accountSettings").text();
                var href = $("#accountHref").attr("href");
                var len =  $('.layui-tab-title li').length;
                publicCode(title,href,len);
            }
            if($(e.target).parents("#microCircleToExamineHref").is("#microCircleToExamineHref")){
                var title = "微圈审核列表";
                var href = $("#microCircleToExamineHref").attr("href");
                var len =  $('.layui-tab-title li').length;
                publicCode(title,href,len);
            }
            if($(e.target).parents("#curriculumToExamineHref").is("#curriculumToExamineHref")){
                var title = "课程审核列表";
                var href = $("#curriculumToExamineHref").attr("href");
                var len =  $('.layui-tab-title li').length;
                publicCode(title,href,len);
            }
            if($(e.target).parents("#microCircleCommentHref").is("#microCircleCommentHref")){
                var title = "微圈评论";
                var href = $("#microCircleCommentHref").attr("href");
                var len =  $('.layui-tab-title li').length;
                publicCode(title,href,len);
            }
            if($(e.target).parents("#curriculumCommentHref").is("#curriculumCommentHref")){
                var title = "课程评论";
                var href = $("#curriculumCommentHref").attr("href");
                var len =  $('.layui-tab-title li').length;
                publicCode(title,href,len);
            }
            if($(e.target).parents("#curriculumListHref").is("#curriculumListHref")){
                var title = $("#classList").text();
                var href = $("#classListHref").attr("href");
                var len =  $('.layui-tab-title li').length;
                publicCode(title,href,len);
            }
            if($(e.target).parents("#curriculumListHref").is("#curriculumListHref")){
                var title = $("#classList").text();
                var href = $("#classListHref").attr("href");
                var len =  $('.layui-tab-title li').length;
                publicCode(title,href,len);
            }
            if($(e.target).parents("#toExamineLogHref").is("#toExamineLogHref")){
                var title = "审核日志";
                var href = $("#toExamineLogHref").attr("href");
                var len =  $('.layui-tab-title li').length;
                publicCode(title,href,len);
            }
        })
        $("#iframe0").contents().find("#pending_transactions").on("click",function (e) {
            if($(e.target).parents("#curriculumToExamineHref2").is("#curriculumToExamineHref2")){
                var title = "课程审核列表";
                var href = $("#curriculumToExamineHref").attr("href");
                var len =  $('.layui-tab-title li').length;
                publicCode(title,href,len);
            }
            if($(e.target).parents("#commodityToExamineHref2").is("#commodityToExamineHref2")){
                var title = "商品审核列表";
                var href = $("#commodityToExamineHref").attr("href");
                var len =  $('.layui-tab-title li').length;
                publicCode(title,href,len);
            }
        })
    }


    //头部常用菜单跳转用户列表
    function jumpUserList() {
        var title = $("#userList").text();
        var href = $("#userListHref").attr("href");
        var len =  $('.layui-tab-title li').length;
        publicCode(title,href,len);
    }
    //头部常用菜单跳转轮播图列表
    function jumpLunImgsList() {
        var title = $("#lunImgsList").text();
        var href = $("#lunImgsListHref").attr("href");
        var len =  $('.layui-tab-title li').length;
        publicCode(title,href,len);
    }

    //头部常用菜单跳转课程列表
    function jumpClassList() {
        var title = $("#classList").text();
        var href = $("#classListHref").attr("href");
        var len =  $('.layui-tab-title li').length;
        publicCode(title,href,len);
    }

    //头部常用菜单跳转后台人员列表
    function jumpBehindUserList() {
        var title = $("#behindUserList").text();
        var href = $("#behindUserListHref").attr("href");
        var len =  $('.layui-tab-title li').length;
        publicCode(title,href,len);
    }

    //头部常用菜单跳转订单统计
    function jumpTransactionImgsList() {
        var title = $("#transactionImgsList").text();
        var href = $("#transactionImgsListHref").attr("href");
        var len =  $('.layui-tab-title li').length;
        publicCode(title,href,len);
    }

    //头部常用菜单跳转部门管理
    function jumpDepartmentList() {
        var title = $("#departmentList").text();
        var href = $("#departmentListHref").attr("href");
        var len =  $('.layui-tab-title li').length;
        publicCode(title,href,len);
    }

    //头部常用菜单跳转优惠券列表
    function jumpCouponList() {
        var title = $("#couponList").text();
        var href = $("#couponListHref").attr("href");
        var len =  $('.layui-tab-title li').length;
        publicCode(title,href,len);
    }

    //头部导航栏点击跳转首页
    function jumpSystemHome() {
        var title = $("#systemHomeHit").attr("title");
        var href = $("#systemHome").attr("href");
        var len =  $('.layui-tab-title li').length;
        publicCode(title,href,len);
    }

    //导航栏公共代码1
    function publicCode(title,href,len) {
        var arr = [];
        $("#hitLi li").each(function () {
            arr.push($(this).text());
        });
        if (arr.indexOf(title) == -1){
            element.tabAdd('tab',{
                title: title,
                content: '<iframe id="iframe'+ len + '" frameborder="0" src="'+href+'"  class="iframe"></iframe>',
                id:len
            })
            //跳转添加选项卡页面
            element.tabChange('tab',len);
            var arr = localStorage.getItem("numArr");
            len = "" + len + "";
            numArr = arr.split(",");
            numArr.push(len);
            localStorage.setItem("numArr",numArr);
        }else {
            //跳转到点击选项卡页面
            var i = arr.indexOf(title);
            i = parseInt($(".layui-tab-title li").eq(i).attr("lay-id"));
            element.tabChange('tab',i);
            var arr = localStorage.getItem("numArr");
            i = "" + i + "";
            numArr = arr.split(",");
            if (i != numArr[numArr.length -1]){
                numArr.push(i);
            }
            localStorage.setItem("numArr",numArr);
        }

    }

    //导航栏公共代码2
    function publicCode2(title,href,len) {
        var arr = [];
        $("#hitLi li").each(function () {
            arr.push($(this).text());
        });
        if (arr.indexOf(title) == -1){
            element.tabAdd('tab',{
                title: title,
                content: '<iframe id="iframe'+ len + '" frameborder="0" src="'+href+'"  class="iframe"></iframe>',
                id:len
            })
            //跳转添加选项卡页面
            element.tabChange('tab',len);
            var arr = localStorage.getItem("numArr");
            len = "" + len + "";
            numArr = arr.split(",");
            numArr.push(len);
            localStorage.setItem("numArr",numArr);
        }else {
            //跳转到点击选项卡页面
            var i = arr.indexOf(title);
            i = parseInt($(".layui-tab-title li").eq(i).attr("lay-id"));
            element.tabChange('tab',i);
            //！！！！！！！！完成添加操作后跳转到对应列表并刷新该列表
            window.frames[i].location.reload();
            var arr = localStorage.getItem("numArr");
            i = "" + i + "";
            numArr = arr.split(",");
            if (i != numArr[numArr.length -1]){
                numArr.push(i);
            }
            localStorage.setItem("numArr",numArr);
        }

    }
    rightClick();

    //右键选项卡删除当前、其他、所有右键选项卡
    function rightClick() {
        $("#hitLi").on("contextmenu","li",function (e) {
            //阻止浏览器默认右键操作
            e.preventDefault();
            $(".rightmenu").css("display","inline");
            index = $(this).attr("lay-id");
            element.tabChange('tab',index);
            var top = $("#hitLi .layui-this").position().top;
            var left = $("#hitLi .layui-this").position().left;
            top += 50;
            left += 20;
            $(".rightmenu").css('position','absolute');
            $(".rightmenu").css('top',top);
            $(".rightmenu").css('left',left);
        });

        $("#hitLi li").on("click",function () {
            $(".rightmenu").css("display","none");
        });

        $(".rightmenu").on("click","li",function () {
            if ($(this).attr("data-type") == "closeNow") { //关闭当前
                if (index != 0){
                    element.tabDelete('tab',index);
                    $(".rightmenu").css("display","none");
                }
                //$("#hitLi ").prop("lay-id","0");
            }
            if ($(this).attr("data-type") == "closeOthers") { //关闭其他
                var tabtitle = $(".layui-tab-title li");
                $.each(tabtitle, function (i) {
                    if ($(this).attr("lay-id") != index && $(this).attr("lay-id") != 0) {
                        element.tabDelete('tab',$(this).attr("lay-id"));
                        $(".rightmenu").css("display","none");
                    }
                })
                //$("#hitLi ").prop("lay-id","0");
            }
            if ($(this).attr("data-type") == "closeAll") { //关闭所有
                var tabtitle = $(".layui-tab-title li");
                $.each(tabtitle, function (i) {
                    if ($(this).attr("lay-id") != 0) {
                        element.tabDelete('tab',$(this).attr("lay-id"));
                        $(".rightmenu").css("display","none");
                    }
                })
            }
        });
    }

    $("body").on("click",function () {
        $(".rightmenu").css("display","none");
    })

    //退出登录
    function loginOut() {
        $.ajax({
            type:"post",
            url:"/login/loginOut",
            data:{},
            dataType:"json",
            success:function (data) {
                if(data.data){
                    //退出到登录页面
                    window.parent.location.href="/login/login.html";
                }
            }
        })
        return false;
    }

    //默认展开系统首页
    function loading() {
        $(".layui-nav-tree li a").each(function () {
            if ($(this).text() == "系统首页"){
                $(this).parent("li").addClass("layui-nav-itemed").siblings("li").removeClass("layui-nav-itemed");
                $(this).parent("li").addClass("closeDao").siblings("li").removeClass("closeDao");
                $(this).siblings("dl").children("dd").addClass("layui-nav-itemed").siblings("dd").removeClass("layui-nav-itemed");
                $(this).siblings("dl").children("dd").addClass("closeDao").siblings("dd").removeClass("closeDao");
                $(this).siblings('dl').children('dd').children('dl').children('dd').children('a').each(function (i,item) {
                    if ($(this).text() == "首页"){
                        $(this).parent().addClass('layui-this');
                    }
                })
            }

        });
    }

    //完成添加操作后跳转到对应列表
    function quickEntry(){
        var quickEntry = $('#quickEntry').val();
        if (quickEntry == "轮播图列表"){
            var href = $("#lunImgsListHref").attr("href");
            var len =  $('.layui-tab-title li').length;
            publicCode2(quickEntry,href,len);
        }else if (quickEntry == "商品列表"){
            var href = $("#commodityListHref").attr("href");
            var len =  $('.layui-tab-title li').length;
            publicCode2(quickEntry,href,len);
        }else if (quickEntry == "用户列表"){
            var href = $("#userListHref").attr("href");
            var len =  $('.layui-tab-title li').length;
            publicCode2(quickEntry,href,len);
        }else if (quickEntry == "课程列表"){
            var href = $("#classListHref").attr("href");
            var len =  $('.layui-tab-title li').length;
            publicCode2(quickEntry,href,len);
        }else if (quickEntry == "优惠券列表"){
            var href = $("#couponListHref").attr("href");
            var len =  $('.layui-tab-title li').length;
            publicCode2(quickEntry,href,len);
        }else if (quickEntry == "后台人员列表"){
            var href = $("#behindUserListHref").attr("href");
            var len =  $('.layui-tab-title li').length;
            publicCode2(quickEntry,href,len);
        }
        $('.submenu').each(function () {
            if($(this).text() == quickEntry){
                $(this).click();
            }
        })
    }
</script>
</body>
</html>